<template>
  <div class="detail-wrapper">
    <detail-header :sightName="sightName"></detail-header>
    <banner :bannerImg="bannerImg" :gallaryImgs="gallaryImgs"></banner>
    <detail-cascade :categoryList="categoryList"></detail-cascade>
  </div>
</template>

<script>
import Banner from '@/pages/details/components/Banner'
import DetailHeader from '@/pages/details/components/DetailHeader'
import DetailCascade from '@/pages/details/components/Cascade'
import axios from 'axios'
export default {
  name: 'Detail',
  data () {
    return {
      sightName: '',
      bannerImg: '',
      gallaryImgs: [],
      categoryList: []
    }
  },
  components: {
    Banner,
    DetailHeader,
    DetailCascade
  },
  methods: {
    getDetailData () {
      axios.get('/static/api/detail.json', {
        params: {
          id: this.$route.params.id
        }
      }).then(this.getDetailDataSucc)
    },
    getDetailDataSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.sightName = data.sightName
        this.bannerImg = data.bannerImg
        this.gallaryImgs = data.gallaryImgs
        this.categoryList = data.categoryList
      }
    }
  },
  mounted () {
    this.getDetailData()
  }
}
</script>

<style lang="stylus" scoped>
  .detail-wrapper
    height: 100rem
</style>
